package com.qdxwx.data.service.card;

import com.qdxwx.common.page.PageRequest;
import com.qdxwx.data.mapper.card.CardMapper;
import com.qdxwx.models.card.Card;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 *Card接口
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Service
public class CardServiceImpl implements CardService {

	@Autowired
	private CardMapper cardMapper;

	@Override
	public int insert(Card card) {
		card.setCreateTime(LocalDateTime.now());
		return cardMapper.insert(card);
	}

	@Override
	public int deleteByIds(String ids) {
		return cardMapper.deleteByIds(ids);
	}

	@Override
	public int update(Card card) {
		return cardMapper.update(card);
	}

	@Override
	public int updateOver() {
		return cardMapper.updateOver();
	}

	@Override
	public Card get(Long id) {
		return cardMapper.selectById(id);
	}


	@Override
	public List<Card> getList(Card card, PageRequest page) {
		return cardMapper.selectList(card, page);
	}

	@Override
	public long count(Card card) {
		return cardMapper.count(card);
	}
}